import torch as pt
from python_ai.common.xcommon import *

pt.set_printoptions(edgeitems=100)

sep('3x4')
x = pt.arange(1, 3*4+1).view(3, 4)
print(x)

sep('unsqueeze dim=1')
x1 = pt.unsqueeze(x, 1)
print(x1)

sep('unsqueeze dim=0')
x0 = pt.unsqueeze(x, 0)
print(x0)

sep('x2: unsqueeze dim=2')
x2 = pt.unsqueeze(x, 2)
print(x2)

sep('x23: unsqueeze dim=3')
x23 = pt.unsqueeze(x2, 3)
print(x23)

sep('x2_: squeeze dim=3')
x2_ = pt.squeeze(x23, 3)
print(x2_)

sep('x_: squeeze dim=2')
x_ = pt.squeeze(x2_, 2)
print(x_)
